﻿<input id="linkPopup" value="" type="hidden"/>
<input id="paramPopup" value="" type="hidden" />
<style>
#ImportDialog {
    top: 0px;
    z-index: 10003;
    position: fixed;
}
</style>
@{
    Html.Telerik().Window()
    .Name("ImportDialog")
    .ClientEvents(events => events.OnOpen("DialogOpen"))
    .Visible(false)
    .Title("TGVR Popup")
    .Draggable(true)
    .Resizable(resizing => resizing.Enabled(false))
    .Modal(true)
    .Width(800)
    .Height(330)
    .Render();
}
<script>
    function DialogOpen() {
        $.ajax({
            type: "GET",
            url: $("#linkPopup").val(),
            data: "param=" + $("#paramPopup").val(),
            success: function (htmlContent) {
                $('#ImportDialog .t-content').html(htmlContent);
            },
            error: function () {
                $('#ImportDialog .t-content').html("<p>Could not import data at this time</p>");
            }
        });
    }
    //DialogOpen();
    var windowElement = $('#ImportDialog');
    //windowElement.data('tWindow').open();

    function popup(url, param) {
        $("#linkPopup").val(url);
        $("#paramPopup").val(param);
        $('#ImportDialog .t-content').html("<div style='margin:100px 300px;width:800px;'><img  alt=\"loadding\" class=\"left\" src='/Content/Images/Site/ajax_loader_red_128.gif' />");
        $('#ImportDialog').show();
        DialogOpen();
//        $('html, body').animate({
//            scrollTop: $("#ImportDialog").offset().top
//        }, 2000);
    }
    
</script>
